package org.smile.auth.session.redis;

import java.io.Serializable;

/**
 * 用于保存session的通用信息
 *
 * @author 胡真山
 */
public class RedisSessionInfo implements Serializable {

    private Long creationTime;
    private String token;

    private String id;

    /**
     * 从session中赋值
     *
     * @param session
     */
    public void fromSession(RedisSession session) {
        this.creationTime = session.getCreationTime();
        this.token = session.getToken();
        this.id=session.getId();
    }

    /**
     * 把属性传到session中
     *
     * @param session
     */
    public void toSession(RedisSession session) {
        session.setCreationTime(this.creationTime);
        session.setToken(this.token);
        session.setId(this.id);
    }

    public String getToken() {
        return token;
    }

    public void setToken(String token) {
        this.token = token;
    }

    public Long getCreationTime() {
        return creationTime;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public void setCreationTime(Long creationTime) {
        this.creationTime = creationTime;
    }

    @Override
    public String toString() {
        return "creationTime:" + this.creationTime+",token:"+this.token;
    }

}
